class Solution {
public:
void rotate(vector<int>& nums, int k) {
        //轮转数组 将数组的元素向右轮转k个位置 
        //用个队列 把456存进来 
        k = k % nums.size();
        vector<int> a;
        vector<int> b;
        for (int i = nums.size() - k; i < nums.size(); i++)
        {
            a.push_back(nums[i]);
        }
        for (int i = 0; i < nums.size()-k; ++i)
        {
            b.push_back(nums[i]);
        }
        int kk = 0;
        for (int i = 0; i < a.size(); ++i)
        {
            nums[kk++] = a[i];
        }
        for (int j = 0; j < b.size(); ++j)
        {
            nums[kk++] = b[j];
        }

    }
};
